<template>
  <div class="fillcontain">
    <div class="box flex-between">
      <h3>系统设置</h3>
      <el-button size="small">添加</el-button>
    </div>
    <div class="table_container box">
      <el-table :data="tableData" highlight-current-row style="width: 100%">
        <el-table-column property="name" label="设置名" width="320"></el-table-column>
        <el-table-column property="value" label="值" width="320"></el-table-column>
        <el-table-column property="time" label="更新时间" width="320"></el-table-column>
        <el-table-column fixed="right" label="操作" width="100">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small" plain>编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="Pagination" style="text-align: left;margin-top: 10px;">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-size="10"
          layout="total, prev, pager, next"
          :total="count"
        ></el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: {
        phone: ""
      },
      inTime: "",
      outTime: "",
      tableData: [
        {
          name: "住户可免费停放车辆数",
          value: "1辆",
          time: "2017-11-03"
        },
        {
          name: "付款后多长时间内离开",
          value: "30分钟",
          time: "2017-11-03"
        },
        {
          name: "访客免费时长",
          value: "2小时",
          time: "2017-11-03"
        },
        {
          name: "访客收费费率",
          value: "5元/小时",
          time: "2017-11-03"
        },
        {
          name: "住户格外收费费率",
          value: "3元/小时",
          time: "2017-11-03"
        },
        {
          name: "月卡价格",
          value: "500元/月",
          time: "2017-11-03"
        },
        {
          name: "季卡价格",
          value: "1000元/季",
          time: "2017-11-03"
        },
        {
          name: "年卡价格",
          value: "3000元/年",
          time: "2017-11-03"
        }
      ],
      currentRow: 10,
      offset: 0,
      limit: 10,
      count: 0,
      currentPage: 1
    };
  },
  components: {},
  created() {
    // this.initData();
  },
  methods: {
    // async initData(){
    //     try{
    //         const countData = await getUserCount();
    //         if (countData.status == 1) {
    //             this.count = countData.count;
    //         }else{
    //             throw new Error('获取数据失败');
    //         }
    //         this.getUsers();
    //     }catch(err){
    //         console.log('获取数据失败', err);
    //     }
    // },
    handleClick(row) {
      console.log(row);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.offset = (val - 1) * this.limit;
      // this.getUsers()
    }
    // async getUsers(){
    //     const Users = await getUserList({offset: this.offset, limit: this.limit});
    //     this.tableData = [];
    //     Users.forEach(item => {
    //         const tableData = {};
    //         tableData.username = item.username;
    //         tableData.registe_time = item.registe_time;
    //         tableData.city = item.city;
    //         this.tableData.push(tableData);
    //     })
    // }
  }
};
</script>

<style lang="less">
// @import url("../style/mixin.less");
@import url("../style/main.less");
.table_container {
  padding: 20px;
}
.box {
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #eee;
  border-radius: 4px;
  .el-form-item {
    margin: 20px 20px 0 0;
  }
}
</style>
